<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var LOL_dogface = function () {
        this.blood = 100
        this.color = 'red'
      }
      // 实例化一个小兵对象
      var dogface = new LOL_dogface()
      dogface.blood = 700
      dogface.color = 'blue'

      // 基于Object.create方法克隆对象
      var cloneDogface = Object.create(dogface)
      console.log(cloneDogface.blood)
      console.log(cloneDogface.color)

      Object.create =
        Object.create ||
        function (obj) {
          var F = function () {}
          F.prototype = obj
          return new F()
        }
    </script>
  </body>
</html>
